package org.mybatis.spring;

import com.liu.proxy.core.MapperProxyFactory;
import org.springframework.beans.factory.FactoryBean;

/**
 * @author LIU
 * @version 1.0
 * @date 2024/1/25 10:27
 * @description TODO
 *  工厂bean
 *   FactoryBean生成某一个类型Bean实例,自定义Bean的创建过程
 */
public class LiuFactoryBean implements FactoryBean {

    private Class mapperClass;

    public LiuFactoryBean(Class mapperClass) {
        this.mapperClass = mapperClass;
    }

    @Override
    public Object getObject()  {
        return MapperProxyFactory.getMapper(mapperClass);
    }

    @Override
    public Class<?> getObjectType() {
        return mapperClass;
    }
}
